<template>
  <div class="body">
    <!-- 对于登录、注册等页面不使用Layout -->
    <AppLayout v-if="!isGuestPage">
      <router-view />
    </AppLayout>
    <!-- 登录、注册等页面直接显示 -->
    <router-view v-else />
  </div>
</template>

<script>
import { mapState, mapActions } from 'vuex'
import AppLayout from './components/AppLayout.vue'

export default {
  name: 'App',
  components: {
    AppLayout
  },
  computed: {
    ...mapState('user', ['isAuthenticated']),
    isGuestPage() {
      return this.$route.meta.guest
    }
  },
  methods: {
      ...mapActions('user', ['logout']),
      async handleLogout() {
        await this.logout()
        this.$router.push('/login')
      }
    }
  }
</script>

<style>
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
}
.body {
  border-radius: 12px; /* 新增圆角样式 */
  padding: 20px; /* 新增内边距 */;
  overflow: hidden; /* 确保内容不会溢出圆角 */
}
</style>
